﻿using System;
using System.Collections.Generic;
using System.Text;
using RegionInterface;
using UnityEngine;
using Common;

public partial class GUIModule : ModuleBase
{
    public ChatMessage Chat;
    public ScoreManager Score;
    public NameTag Tag;
    public test t;
    public Dogtag DogLable;
    public GUIModule()
    {
        Chat = new ChatMessage(this);
        Score = new ScoreManager(this);
        Tag = new NameTag(this);
        t = new test(this);
        DogLable = new Dogtag(this);
        
        AppInterface.GUIModule = this as IGUIModule;
        AppInterface.NetworkModule.RegisterNetworkHandle(this as INetwork);
        reCalculateScreenSize();
    }
    public override void OnGUI() 
    {
        if (screenWidth != Screen.width || screenHeight != Screen.height)
        {
            reCalculateScreenSize();
        }
        Chat.OnGUI();
        Tag.OnGUI();
        t.OnGUI();
        DogLable.OnGUI();
    }
    private void reCalculateScreenSize()
    {
        screenWidth = Screen.width;
        screenHeight = Screen.height;
        widthScale = screenWidth / defaultWidth;
        heightScale = screenHeight / defaultHeight;
        screenChange(screenWidth, screenHeight);
    }
    public override void Update()
    {
        Score.Update();
        Tag.Update();
    }
    public override void FixedUpdate()
    {
        Tag.FixedUpdate();
        t.FixedUpdate();
    }
}
